//
//  multigraph.cpp
//  math-core
//
//  Created by Armin Lunkeit on 17.02.14.
//  Copyright (c) 2014 Armin Lunkeit. All rights reserved.
//

#include "multigraph.h"
#include <algorithm>
#include <iostream>

MultiGraph::MultiGraph()
{
    
}

MultiGraph::~MultiGraph()
{
    
}

void MultiGraph::addVertex( const PVertex& v )
{
    _elements.push_back( SubGraph( v, Edges() ));
}

void MultiGraph::addEdge( const PEdge& e )
{
    for( SubGraphs::iterator iter = _elements.begin(); iter != _elements.end(); iter++ )
    {
        if( iter->first == e->head())
        {
            iter->second.push_back(e);
            
            std::cout << "edge added to internal management!" << std::endl;
            
            break;
        }
    }
}

